//
//  LoginTextField.m
//  QuickCure1
//
//  Created by 胡晨晨 on 16/10/31.
//  Copyright © 2016年 maoge. All rights reserved.
//

#import "LoginTextField.h"

@implementation LoginTextField



- (instancetype)initWithPlaceholder:(NSString*)placeholder
{
    if (self = [super init]) {
        //占位文字
        self.placeholder = placeholder;
        //左视图总是显示
        self.leftViewMode  = UITextFieldViewModeAlways;
        //设置左视图图片
        UIImageView *iv = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"product_img_icon_xieyi.png"]];
        self.leftView = iv;
        //右边清除按钮
        self.clearButtonMode = UITextFieldViewModeWhileEditing;
        //边框
        self.borderStyle = UITextBorderStyleRoundedRect;
    }
    
    return self;
    
}


//重写左边图片的缩进
- (CGRect)leftViewRectForBounds:(CGRect)bounds{
    return CGRectMake(5, 6, 16.8, 18);
}

@end
